package thread.basepackage.t1;

/**
 * 使用异常停止线程
 * Created by cuihao on 2017/11/28.
 */
public class MyThread extends Thread {
    @Override
    public void run() {
        super.run();
        for (int i = 0; i < 50000; i++) {
            if (this.isInterrupted()) {
                System.out.println("停止状态，退出！");
                break;
            }
            System.out.println("i=" + (i + 1));
        }
    }
}
